"""
    Schedule controller.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController
from mnemoply.utils import LocalMenuItem

class LessonInScheduleController(LookupController, CRUDController):
    model_object = model.LessonInSchedule
    lookup_columns = [
        TableCol(name='office_name', caption=_("Office")),
        TableCol(name='ed_group', caption=_("Group"), size=20),
        TableCol(name='day_of_week', caption=_("Day of week"), size=13),
        TableCol(name='time', caption=_("Time"), size=6),
        TableCol(name='room', caption=_("Room"), size=2),
    ]

    view_fields = ['groupID', 'classroomID', 'dayOfWeek', 'startTimeHour', 'startTimeMinute', 'comment']
    edit_fields = []

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource("lesson_in_schedule_lookup"),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)
        self.object_local_menu = [LocalMenuItem(caption=_('List'), href='../list')]
        self.local_menu = []

exposed = LessonInScheduleController()
